<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="ISO-8859-1"%>
<%@ page import = "quiz.Question" %>
<jsp:include page="templates/header.jsp" flush="true">
	<jsp:param value = "Create New Multiple Choice Question | Quizzard" name = "title" />
</jsp:include>
<jsp:include page="templates/title_bar.jsp" flush = "true">
	<jsp:param value = "New Multiple Choice Question" name = "title" />
</jsp:include>
<div id = "content">
<div class = "center">
<%
	int numAnswers = Integer.parseInt((String)request.getParameter("numAnswers"));

	String error = (String)request.getAttribute("error");
	if (error != null) {
		out.println("<div id = 'error'>"+error+"</div>");
	}
%>
<p>Add a new question</p>
<form method = "post" action = "CreateQuestion">
<p><label for = "question">Question </label><input type = "text" name = "question" />
<p><label for = "weight">Weight </label><input type = "text" name = "weight" /></p>
<p><label for = "time">Maximum Time </label><input type = "text" name = "time" /></p>
<input type = "hidden" name = "numAnswers" value = "<%= numAnswers %>" />
<input type = "hidden" name = "questionType" value = "<%= Question.MC %>" />
<input type = "hidden" name = "quizID" value = "quizid" />
<%
	for (int i = 0; i < numAnswers; i++) {
		out.println("<div class = \"bottom_border\">Answer "+(i + 1)+":<input type = \"text\" name = \"answer"+i+"\" /> Correct? <input type = \"checkbox\" name = \"answer"+i+"correct\" /></div>");
	}
%>
<input type = "submit" value = "Add Question" class = "btn" />
</form>
</div>
</div>
<jsp:include page="templates/footer.jsp" flush="true" />